﻿// <copyright file="WSIdentity.cs" company="SharpSTS">
// Copyright (c) 2007, 2008 All Right Reserved, http://sharpsts.com/
//
// This source is subject to the Microsoft Permissive License.
// Please see the License.txt file for more information.
// All other rights reserved.
//
// THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY 
// KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
// PARTICULAR PURPOSE.
//
// </copyright>
// <author>Barry Dorrans</author>
// <email>barryd@idunno.org</email>
// <date>2008-06-16</date>
// <summary>Holds WSIdentity constants.</summary>

namespace SharpSTS.Constants
{
    /// <summary>
    /// Holds WSIdentity constants
    /// </summary>
    internal static class WSIdentity
    {
        /// <summary>
        /// The claims element hierarchy
        /// </summary>
        internal static class Claims
        {
            /// <summary>
            /// This mandatory element describes a claim in the RST.
            /// </summary>
            internal static class Elements
            {
                /// <summary>
                /// This mandatory element describes the claim requested.
                /// </summary>
                public const string ClaimType = "ClaimType";
            }

            /// <summary>
            /// The claim type element.
            /// </summary>
            internal static class ClaimType
            {
                /// <summary>
                /// Holds attribute comments
                /// </summary>
                public static class Attributes
                {
                    /// <summary>
                    /// The URI of the claim requested.
                    /// </summary>
                    public const string Uri = "Uri";

                    /// <summary>
                    /// A value indicating if the claim fufillment is optional.
                    /// </summary>
                    public const string Optional = "Optional";
                }
            }
        }

        /// <summary>
        /// The information card element hierarchy.
        /// </summary>
        internal static class InformationCardReference
        {
            /// <summary>
            /// Holds namespace constants.
            /// </summary>
            internal static class Namespace
            {
                /// <summary>
                /// The Namespace URI.
                /// </summary>
                public const string Uri = WSIdentity.Namespace.Uri;

                /// <summary>
                /// The namespace prefix.
                /// </summary>
                public const string Prefix = WSIdentity.Namespace.Prefix;
            }

            /// <summary>
            /// Holds element names.
            /// </summary>
            internal static class Elements
            {
                /// <summary>
                /// The element name for the card identifier element.
                /// </summary>
                public const string CardId = "CardId";

                /// <summary>
                /// The element name for the card version element.
                /// </summary>
                public const string CardVersion = "CardVersion";
            }
        }

        /// <summary>
        /// An optional top-level element contains the PPID information item.
        /// </summary>
        internal static class ClientPseudonym
        {
            /// <summary>
            /// Holds namespace constants.
            /// </summary>
            internal static class Namespace
            {
                /// <summary>
                /// The Namespace URI.
                /// </summary>
                public const string Uri = WSIdentity.Namespace.Uri;

                /// <summary>
                /// The namespace prefix.
                /// </summary>
                public const string Prefix = "";
            }

            /// <summary>
            /// Holds element names.
            /// </summary>
            internal static class Elements
            {
                /// <summary>
                /// This optional element contains the PPID that the client has submitted for 
                /// use in the issued token. The IP/STS MAY use this value as the input (a seed) 
                /// to a custom function and the result used in the issued token
                /// </summary>
                public const string PPID = "PPID";
            }
        }

        /// <summary>
        /// Holds namespace constants.
        /// </summary>
        internal static class Namespace
        {
            /// <summary>
            /// The Namespace URI.
            /// </summary>
            public const string Uri = "http://schemas.xmlsoap.org/ws/2005/05/identity";

            /// <summary>
            /// The namespace prefix.
            /// </summary>
            public const string Prefix = "wsid";
        }

        /// <summary>
        /// Holds element names.
        /// </summary>
        internal static class Elements
        {
            /// <summary>
            /// This required element provides a specific reference for the information card by which it can be uniquely 
            /// identified within the scope of an issuer.
            /// </summary>
            /// <remarks>
            /// This reference MUST be included by an identity selector in all token requests sent to the identity 
            /// provider based on that information card.
            /// </remarks>
            public const string InformationCardReference = "InformationCardReference";
            
            /// <summary>
            /// The element indicating if a display token has been requested.
            /// </summary>
            public const string RequestDisplayToken = "RequestDisplayToken";

            /// <summary>
            /// The Client Pseudonym element.
            /// </summary>
            /// <remarks>
            /// This is a selector suggested PPID.
            /// </remarks>
            public const string ClientPseudonym = "ClientPseudonym";

            /// <summary>
            /// This required element provides a supported claim for a managed information card.
            /// </summary>
            public const string SupportedClaimType = "SupportedClaimType";

            /// <summary>
            /// This optional element provdes a display token as part of the RSTR.
            /// </summary>
            public const string RequestedDisplayToken = "RequestedDisplayToken";

            /// <summary>
            /// This optional element provdes a display token as part of the RSTR.
            /// </summary>
            public const string DisplayToken = "DisplayToken";

            /// <summary>
            /// This optional element provdes a display token as part of the RSTR.
            /// </summary>
            public const string DisplayTokenText = "DisplayTokenText";

            /// <summary>
            /// This optional element provdes a display token as part of the RSTR.
            /// </summary>            
            public const string DisplayClaim = "DisplayClaim";
            
            /// <summary>
            /// This optional element provides a friendly name for this individual.
            /// </summary>
            public const string DisplayTag = "DisplayTag";

            /// <summary>
            /// This optional element provides a value for this individual.
            /// </summary>
            public const string DisplayValue = "DisplayValue";

            /// <summary>
            /// This optional element provides a description of the semantics for this individual claim type. 
            /// The content of this element MAY be localized in a specific language.
            /// </summary>
            public const string Description = "Description";

            /// <summary>
            /// The mandatory element provides the encapsulating element for a managed information card.
            /// </summary>
            public const string InformationCard = "InformationCard";

            /// <summary>
            /// This optional element provides a friendly textual name for the 
            /// issued information card. The content of this element MAY be localized in a specific language.
            /// </summary>
            public const string CardName = "CardName";
            
            /// <summary>
            /// This optional element contains a base64 encoded inline image that provides a graphical image 
            /// for the issued information card. It SHOULD contain an image within the size range of 60 pixels wide by 45 
            /// pixels high and 200 pixels wide by 150 pixels high.
            /// </summary>
            public const string CardImage = "CardImage";
            
            /// <summary>
            /// This required element provides a unique identifier in the form of a URI for the specific information card. 
            /// The identifier provider must be able to identify the specific information card based on this identifier.
            /// </summary>
            public const string CardId = "CardId";

            /// <summary>
            /// This required element provides a versioning epoch for the information card issuance infrastructure used 
            /// by the identity provider.
            /// </summary>
            /// <remarks>
            ///  The minimum value for this field MUST be 1.
            /// </remarks>
            public const string CardVersion = "CardVersion";

            /// <summary>
            /// This required element provides a logical name for the issuer of the information card. 
            /// If a relying party specifies a token issuer by its logical name, then the content of this element MUST be 
            /// used to match the required token issuer with an information card.
            /// </summary>
            public const string Issuer = "Issuer";

            /// <summary>
            /// This required element provides the date and time when the information card was issued.
            /// </summary>
            public const string TimeIssued = "TimeIssued";

            /// <summary>
            /// This optional element provides the date and time after which the information card SHOULD be treated as expired and invalid.
            /// </summary>
            public const string TimeExpires = "TimeExpires";
            
            /// <summary>
            /// This required element contains the list of claim types that are offered by the identity provider.
            /// </summary>
            public const string SupportedClaimTypeList = "SupportedClaimTypeList";

            /// <summary>
            /// This required element contains the list of token types that are offered by the identity provider.
            /// </summary>
            public const string SupportedTokenTypeList = "SupportedTokenTypeList";
            
            /// <summary>
            /// This required element provides an ordered list of security token service (IP/STS) endpoints, and corresponding credential descriptors 
            /// (implying the required authentication mechanisms), where tokens can be requested. Each service endpoint MUST be tried in order by 
            /// the service requester when requesting tokens.
            /// </summary>
            public const string TokenServiceList = "TokenServiceList";

            /// <summary>
            /// This required element describes a single token issuing endpoint.
            /// </summary>
            public const string TokenService = "TokenService";

            /// <summary>
            /// This required element indicates the credential type to use to authenticate to the token issuing endpoint.
            /// </summary>
            public const string UserCredential = "UserCredential";

            /// <summary>
            /// This optional element provides a hint (string) to be displayed to the user to prompt 
            /// for the correct credential (e.g. a hint to insert the right smart card). The content of this element MAY be localized in a specific language.
            /// </summary>
            public const string DisplayCredentialHint = "DisplayCredentialHint";
            
            /// <summary>
            /// This required element provides an unambiguous descriptor for the username and password credential 
            /// to use for authenticating to the token issuing endpoint.
            /// </summary>
            public const string UserNamePasswordCredential = "UsernamePasswordCredential";

            /// <summary>
            /// This required element provides an unambiguous descriptor for the certificate credential 
            /// to use for authenticating to the token issuing endpoint.
            /// </summary>
            public const string X509V3Credential = "X509V3Credential";

            /// <summary>
            /// This required element provides an unambiguous descriptor for the kerberos credential 
            /// to use for authenticating to the token issuing endpoint.
            /// </summary>
            public const string KerberosV5Credential = "KerberosV5Credential";

            /// <summary>
            /// This required element provides an unambiguous descriptor for the self issued credential 
            /// to use for authenticating to the token issuing endpoint.
            /// </summary>
            public const string SelfIssuedCredential = "SelfIssuedCredential";
            
            /// <summary>
            /// This optional element indicates that token requests MUST include information identifying the relying party 
            /// where the issued token will be used. 
            /// The relying party information MUST be included as the content of a wsp:AppliesTo element in the token request.
            /// </summary>
            public const string RequireAppliesTo = "RequireAppliesTo";

            /// <summary>
            /// This optional element provides an authentication hint for the username in username/password
            /// managed information cards.
            /// </summary>            
            public const string UserName = "Username";

            /// <summary>
            /// This optional element provides an authentication hint for PPID of the self issued information card
            /// for self-issued authenticated managed information cards.
            /// </summary>            
            public const string PrivatePersonalIdentifier = "PrivatePersonalIdentifier";

            /// <summary>
            /// This optional element provides the location of the privacy statement of the identity provider.
            /// </summary>
            public const string PrivacyNoticeAt = "PrivacyNotice";
        }

        /// <summary>
        /// Holds the key type constants.
        /// </summary>
        internal static class KeyTypes
        {
            /// <summary>
            /// This represents the NoProofKey request which comes as part of the RSTR.
            /// </summary>
            public const string NoProofKey = Namespace.Uri + "/NoProofKey";
        }

        /// <summary>
        /// Holds attribute names.
        /// </summary>
        internal static class Attributes
        {
            /// <summary>
            /// Optional attribute, indicating if a claim request is option.
            /// </summary>
            public const string Optional = "Optional";
            
            /// <summary>
            /// This required attribute provides a MIME type specifying the format of the included card image. 
            /// The information card profile supports multiple image formats (e.g., JPEG, GIF) as enumerated 
            /// in the schema.
            /// </summary>
            public const string MimeType = "MimeType";

            /// <summary>
            /// General Uri attribute.
            /// </summary>
            public const string Uri = "Uri";

            /// <summary>
            /// General Method attribute.
            /// </summary>
            public const string Method = "Method";
        }

        /// <summary>
        /// Holds fault codes.
        /// </summary>
        internal static class FaultCodes
        {
            /// <summary>
            /// Fault code indicating the applies to element was not present in the request.
            /// </summary>
            public const string MissingAppliesTo = "MissingAppliesTo";

            /// <summary>
            /// Fault code indicating an invalid proof key was enclosed in the request.
            /// </summary>
            public const string InvalidProofKey = "InvalidProofKey";

            /// <summary>
            /// Fault code indicating the card reference could not be found.
            /// </summary>
            public const string UnknownCardReference = "UnknownCardReference";

            /// <summary>
            /// Fault code indicating a card refresh is required.
            /// </summary>
            public const string InformationCardRefreshRequired = "InformationCardRefreshRequired";

            /// <summary>
            /// Fault code indicating the required claims processing failed.
            /// </summary>
            public const string FailedRequiredClaims = "FailedRequiredClaims";
        }
    }
}
